package jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class Test {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        Class.forName("com.mysql.cj.jdbc.Driver");
        try(
            Connection connection= DriverManager.getConnection("jdbc:mysql://localhost:3306/tedu?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true",
                    "root","root");

        ){
            Statement state=connection.createStatement();
            String sql="CREATE TABLE student1(" +
                     "    ID INT AUTO_INCREMENT PRIMARY key," +
                    "    NAME VARCHAR(30)," +
                    "    AGE VARCHAR(3)," +
                    "    CLASS_ID INT(3)" +
                    ")";
            System.out.println("执行完毕");
            state.execute(sql);
            System.out.println("sql执行完毕");
        }
    }
}
